package com.hksj.em.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hksj.common.core.model.Rest;
import com.hksj.em.query.DevicesInfoQuery;
import com.hksj.em.service.DevicesInfoService;
import com.hksj.em.vo.DevicesVO;
import com.hksj.em.vo.LightingDevicesVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

@Api(tags = "智慧手术室-设备列表")
@RestController
@RequestMapping("/api/devicesInfo")
public class DevicesInfoController {

    @Autowired
    private DevicesInfoService devicesInfoService;

    @ApiOperation(value = "根据专业编码查询设备数量")
    @PostMapping("/queryDevicesAmountByCode")
    public Rest<Map<String,Integer>> queryDevicesAmountByCode(@RequestBody DevicesInfoQuery query){
        return Rest.ok(devicesInfoService.queryDevicesAmountByCode(query));
    }

    @ApiOperation(value = "查询设备列表")
    @PostMapping("/queryDevicesInfoByPage")
    public Rest<IPage<DevicesVO>> queryDevicesInfoByPage(@RequestBody DevicesInfoQuery query){
        IPage<DevicesVO> page = devicesInfoService.queryAirConditioningDevices(query);
        return Rest.ok(page);
    }

    @ApiOperation(value = "查询灯光设备列表")
    @PostMapping("/queryLightingsInfoByPage")
    public Rest<IPage<LightingDevicesVO>> queryLightingsInfoByPage(@RequestBody DevicesInfoQuery query){
        IPage<LightingDevicesVO> page = devicesInfoService.queryLightingsInfoByPage(query);
        return Rest.ok(page);
    }
}
